package com.ruoyi.buss.report.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.buss.utils.ListUtil;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.buss.report.domain.ReportWgcjVillageLsb;
import com.ruoyi.buss.report.service.IReportWgcjVillageLsbService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 网格村居报4.2.2-1Controller
 * 
 * @author sxy
 * @date 2021-07-16
 */
@RestController
@RequestMapping("/reportLsb")
public class ReportWgcjVillageLsbController extends BaseController
{
    @Autowired
    private IReportWgcjVillageLsbService reportWgcjVillageLsbService;

    @Autowired
    private TokenService tokenService;

    /**
     * 查询网格村居报4.2.2-1列表
     */
    @PreAuthorize(hasPermi = "buss:wgcjlsb:list")
    @GetMapping("/wgcjywjdb")
    public TableDataInfo list(ReportWgcjVillageLsb reportWgcjVillageLsb)
    {
        reportWgcjVillageLsb.setSjrq(ListUtil.getSjrq(reportWgcjVillageLsb.getSjrq()));
        LoginUser userInfo = tokenService.getLoginUser();

        startPage();
        List<ReportWgcjVillageLsb> list = reportWgcjVillageLsbService.selectReportWgcjVillageLsbList(reportWgcjVillageLsb,userInfo,0);
        return getDataTable(list);
    }
    /**
     * 导出网格村居报4.2.2-1列表
     */
    @PreAuthorize(hasPermi = "buss:wgcjlsb:exportWgcjywjdbService")
    @Log(title = "网格村居业务进度表", businessType = BusinessType.EXPORT)
    @PostMapping("/exportWgcjywjdbService")
    public void exportWgcjywjdbService(HttpServletResponse response, ReportWgcjVillageLsb reportWgcjVillageLsb) throws IOException
    {
        reportWgcjVillageLsb.setSjrq(ListUtil.getSjrq(reportWgcjVillageLsb.getSjrq()));
        LoginUser userInfo = tokenService.getLoginUser();
        List<ReportWgcjVillageLsb> list = reportWgcjVillageLsbService.selectReportWgcjVillageLsbList(reportWgcjVillageLsb,userInfo,0);
        ExcelUtil<ReportWgcjVillageLsb> util = new ExcelUtil<ReportWgcjVillageLsb>(ReportWgcjVillageLsb.class);
        util.exportExcel(response, list, "网格村居业务进度表");
    }
    /**
     *  网格村居业务进度表
     */
    @PreAuthorize(hasPermi = "buss:wgcjywjdbhz:list")
    @GetMapping("/wgcjywjdbhz")
    public TableDataInfo wgcjywjdbhz(ReportWgcjVillageLsb reportWgcjVillageLsb)
    {
        reportWgcjVillageLsb.setSjrq(ListUtil.getSjrq(reportWgcjVillageLsb.getSjrq()));
        LoginUser userInfo = tokenService.getLoginUser();

        startPage();
        List<ReportWgcjVillageLsb> list = reportWgcjVillageLsbService.selectReportWgcjVillageLsbList(reportWgcjVillageLsb,userInfo,1);
        return getDataTable(list);
    }

    /**
     * 4.2.2-1  网格村居业务进度表(月趋势图)
     */
    @PreAuthorize(hasPermi = "buss:wgcjywjdbMonth:list")
    @GetMapping("/wgcjywjdbMonth")
    public TableDataInfo wgcjywjdbMonth(ReportWgcjVillageLsb reportWgcjVillageLsb)
    {
        reportWgcjVillageLsb.setSjrq(ListUtil.getSjrq(reportWgcjVillageLsb.getSjrq()));
        LoginUser userInfo = tokenService.getLoginUser();

        startPage();
        List<ReportWgcjVillageLsb> list = reportWgcjVillageLsbService.selectReportWgcjVillageLsbList(reportWgcjVillageLsb,userInfo,2);
        return getDataTable(list);
    }




}
